package com.eqdd.yiqidian.ui.gongneng.renshi;

import android.content.Intent;
import android.view.View;

import com.eqdd.annotation.datasave.DealCodeClass;
import com.eqdd.yiqidian.base.Config;
import com.eqdd.yiqidian.box.ItemDecoration.SectionDividerItemDecoration;
import com.eqdd.yiqidian.bean.EnterBean;
import com.eqdd.yiqidian.ui.base.BaseEnterActivity;
import com.eqdd.yiqidian.ui.companyspace.CompanySpaceActivity;
import com.eqdd.yiqidian.ui.gongneng.kehu.KehuActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.check.HRCheckActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.finance.FinanceManagerActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.gonggao.GonggaoGuanliActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.kaoqin.KaoqinGuanliActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.contract.ContractManageActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.meeting.MeetingManagerActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.qiyewenhua.QiyewenhuaActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.quanxian.AuthorityActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.renliziyuangongju.RenliziyuanGongjuActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.train.HRTrainActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.xinchoufuli.XinchouFuliGuanliActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.yuangongdangan.YuangongDanganActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.zhaopinguanli.ZhaopinGuanliActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.zuzhiguanli.ZuzhiGuanliActivity;
import com.eqdd.yiqidian.utils.DensityUtil;
import com.eqdd.yiqidian.utils.ToastUtil;

/**
 * Created by lvzhihao on 17-4-19.
 */

public class RenshiActivity extends BaseEnterActivity {

    private int[] decoders = new int[]{1, 5, 7};
    private String[] contents = new String[]{
            "人事的审批",
            "组织管理",
            "考勤管理",
            "招聘管理",
            "培训管理",
            "财务管理",
            "会议管理",
            "客户列表",
            "员工档案管理",
            "劳动合同管理",
            "权限设置",
            "公告-小喇叭管理",
            "企业文化",
            "企业空间"

    };

    private Class[] classes = new Class[]{
            HRCheckActivity.class,
            ZuzhiGuanliActivity.class,
            KaoqinGuanliActivity.class,
            ZhaopinGuanliActivity.class,
            HRTrainActivity.class,
            FinanceManagerActivity.class,
            MeetingManagerActivity.class,
            KehuActivity.class,
            YuangongDanganActivity.class,
            ContractManageActivity.class,
            AuthorityActivity.class,
            GonggaoGuanliActivity.class,
            QiyewenhuaActivity.class,
            CompanySpaceActivity.class,
            XinchouFuliGuanliActivity.class,
            RenliziyuanGongjuActivity.class,

    };

    @DealCodeClass(classes = {HRCheckActivity.class})
    public void updateShenpi(int num) {
        updateNum(0, num);
    }

    @DealCodeClass(classes = {ContractManageActivity.class})
    public void updateLaodonghetong(int num) {
        updateNum(9, num);
    }

    @DealCodeClass(classes = {YuangongDanganActivity.class})
    public void updateYuandongdangan(int num) {
        updateNum(8, num);
    }


    @Override
    public void itemClick(int p) {
        if (classes[p] != null) {
            if (p == 7) {
                Intent intent = new Intent(this, classes[p]);
                intent.putExtra(Config.TYPE, 1);
                startActivity(intent);
            } else {
                startActivity(classes[p]);
            }

        } else {
            ToastUtil.showShort("该模块暂未开发");
        }
    }

    @Override
    public void initEnterData() {
        isDealCode = true;
        int index = 0;
        initTopTitleBar(View.VISIBLE, "人事");
        for (int i = 0; i < contents.length; i++) {
            EnterBean enterBean = new EnterBean();
            if (i == 0) {
                enterBean.setTop(true);
            }
            if (index < decoders.length && i == decoders[index]) {
                index++;
                enterBean.setBottom(true);
                enterBean.setUnderLine(false);
            }
            enterBean.setContent(contents[i]);
            enterBean.setIcon(false);
            enterBean.setEnter(true);
            enterBeans.add(enterBean);
        }

        dataBinding.recyclerView.addItemDecoration(new SectionDividerItemDecoration(this, 1, 7, 2, 4).setHeadHeight(30));
    }

    @Override
    public void lastRun() {
        if (register != null) {
            ((RenshiActivity$$DealCodeInjector) register).update1();
            ((RenshiActivity$$DealCodeInjector) register).update2();
            ((RenshiActivity$$DealCodeInjector) register).update3();
        }
    }
}
